-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to run pg_repack by non-superuser #431
Conversation
Fixed the bug that segmentation fault occurs when default_transaction_read_only is turned on during repacking. bug: #426
14c784f
to
139895a
Compare
Ah, nice, comes with additional tests. I like that. |
139895a
to
ecbc587
Compare
Now everybody how has access to repack_trigger() and repack_apply() and relevant objects can call that functions. Functions repack_swap(), repack_drop() and repack_index_swap() can be called by superuser and owners of a table. Cherry-pick the commit 326b6e1 to not cause segmentation fault when using -k option and not having enough permissions.
ecbc587
to
a692b14
Compare
I'd like to merge the PR this week if no objections. |
New version allows to run pg_repack by a non-superuser. PR on pg_repack repo: reorg/pg_repack#431
New version allows to run pg_repack by a non-superuser. PR on pg_repack repo: reorg/pg_repack#431
@za-arthur thanks for this work! Any plans on tagging a Line 5 in 7e697c9
|
Our solutions engineers and some customers would like to have this extension available. We are using a commit instead of a tagged release because pg_repack maintainers have not tagged a release which contains the commit that allows us to run pg_repack as a non-superuser. Link: reorg/pg_repack#431 (comment) Signed-off-by: Tristan Partin <[email protected]>
Our solutions engineers and some customers would like to have this extension available. We are using a commit instead of a tagged release because pg_repack maintainers have not tagged a release which contains the commit that allows us to run pg_repack as a non-superuser. Closes: neondatabase/cloud#18890 Link: reorg/pg_repack#431 (comment) Signed-off-by: Tristan Partin <[email protected]>
Our solutions engineers and some customers would like to have this extension available. We are using a commit instead of a tagged release because pg_repack maintainers have not tagged a release which contains the commit that allows us to run pg_repack as a non-superuser. Closes: neondatabase/cloud#18890 Link: reorg/pg_repack#431 (comment) Signed-off-by: Tristan Partin <[email protected]>
@ololobus new version was released https://github.com/reorg/pg_repack/tree/ver_1.5.2. Although the website wasn't updated yet. |
@za-arthur thanks! The git tag is what I actually needed |
Our solutions engineers and some customers would like to have this extension available. We are using a commit instead of a tagged release because pg_repack maintainers have not tagged a release which contains the commit that allows us to run pg_repack as a non-superuser. Closes: neondatabase/cloud#18890 Link: reorg/pg_repack#431 (comment) Signed-off-by: Tristan Partin <[email protected]>
Our solutions engineers and some customers would like to have this extension available. We are using a commit instead of a tagged release because pg_repack maintainers have not tagged a release which contains the commit that allows us to run pg_repack as a non-superuser. Closes: neondatabase/cloud#18890 Link: reorg/pg_repack#431 (comment) Signed-off-by: Tristan Partin <[email protected]>
The option
--no-superuser-check
allows to by-pass the check if the user is a superuser. That was done for users which run pg_repack on Amazon, where users cannot run it as a superuser.The problem is that the option
--no-superuser-check
works only on the CLI level, skipping the check only by thepg_repack
client. But there are also checks done by the extension functions exported to SQL.The PR removes the check that the user is a superuser from functions
repack_trigger()
andrepack_apply()
. That check is redundant since queries executed by that functions can be executed by a user manually. Moreoverrepack_trigger()
is aSECURITY DEFINER
function, which means that it is executed with superuser privileges (pg_repack
extension can be created only by superuser).The PR changes privilege check in functions
repack_swap()
,repack_drop()
andrepack_index_swap()
. Now that functions can be run by an owner of a table. That check is necessary since_swap
functions swap relfilenodes onpg_class
system catalog table.repack_drop()
acquires ACCESS EXCLUSIVE lock and therefore it also requires privilege check.Additionally I cherry-picked the commit 326b6e1 from the PR #427. Otherwise
pg_repack
will fall with segmentation fault in case of lack of permissions.Relevant issues: